﻿using System;
using System.Data;

namespace EasyMapping.Common.Utility
{
    public class TypeConverter
    {
        public static SqlDbType GetSqlDbType(string name)
        {
            string[] arr = name.Split('.');
            if(arr.Length <= 1)
            {
                throw new ArgumentException("Missing Separator .");
            }
            string suffix = arr[arr.Length - 1];
            SqlDbType result = (SqlDbType)Enum.Parse(typeof(SqlDbType), suffix);
            return result;             
        }
    }
}
